
const defaultState = {
    num:2
}

const reducer = (state=defaultState,action)=>{
    switch(action.type){
        case 'add':
            return {
                num: state.num + 1
            }
        case 'delete':
            return {
                num: state.num - 1
            }
        case 'inputValue':
            return {
                num:Number(action.value )
            }
        default:
            return state
    }
}

export default reducer